$(function () {
  //重点人员管理 打开窗口
  $('.keyPerson-trigger').on('click', function (event) {
    event.preventDefault();
    $('.keyPerson-pop').addClass('is-visible3');
    $('#keyPersonModal input').val('');
    $("#keyPersonTableSelectAll").prop("checked", false);
    keyPersonPageList(1);

  });
  //重点人员管理 关闭窗口
  $('.keyPerson-pop').on('click', function (event) {
    if (
      $(event.target).is('.cd-popup-close') ||
      $(event.target).is('.keyPerson-pop')
    ) {
      event.preventDefault();
      $(this).removeClass('is-visible3');
      $('#keyPersonTableSelectAll').prop('checked', false);
    }
  });

  // 全选 反选
  $('#keyPersonTableSelectAll').on('click', function () {
    var allcheck = $('#keyPersonTableSelectAll').prop('checked');
    $('#keyPersonModal tbody .check').prop('checked', allcheck);
  });
  // 反选
  $('#keyPersonModal tbody').on('click', '.check', function () {
    var length1 = $('#keyPersonModal tbody').find(':checkbox').length;
    var length2 = $('#keyPersonModal tbody').find(':checked').length;
    if (length1 == length2) {
      $('#keyPersonTableSelectAll').prop('checked', true);
    } else {
      $('#keyPersonTableSelectAll').prop('checked', false);
    }
  });
  //  删除重点人员
  $('#keyPersonDelBtn').on('click', function () {
    if ($('#keyPersonModal tbody input[type=checkbox]:checked').length > 0) {
      $('#keyPersonDelBox').addClass('is-visible3');
    }

  });


  //  删除实时通知
  $("#keyPersonDelBox .delConfirm").on('click', function () {
    $('#keyPersonModal tbody input[type=checkbox]:checked').each(function () {
      var thisid = $(this).attr('thisid');
      var obj = {};
      obj.id = thisid;
      jsonData = JSON.stringify(obj);
      $.ajax({
        url: '/keyPersonnel/del?id=' + thisid,
        type: 'delete',
        data: jsonData,
        contentType: 'application/json',
        async: false,
        success: function (res) {
          console.log(res);
        }
      });
    });
    if ($('#keyPersonTableSelectAll').prop('checked')) {
      keyPersonPage = keyPersonPage - 1;
      if (keyPersonPage < 1) {
        keyPersonPage = 1;
      }
    }
    keyPersonPageList(keyPersonPage);
    // 微型消防站管理 获取总页数 点击分页渲染列表
    keyPersonPageFunc(keyPersonPage);
    $('#keyPersonTableSelectAll').prop('checked', false);
    tipModalFunc('删除成功!');
    $('#keyPersonDelBox').removeClass('is-visible3');
  });

  var keyPersonPage = 1;
  var keyPersonPageNum = 1;
  // 重点人员分页
  function keyPersonPageFunc(pageSum, startPageNum) {
    console.log(pageSum);
    if (pageSum <= 1) {
      $('#keyPersonPageBox .pageJump').hide();
    } else {
      $('#keyPersonPageBox .pageJump').show();
    }
    Page({
      num: pageSum, //页码数
      startnum: startPageNum, //指定页码
      elem: $('#keyPersonPage'), //指定的元素
      callback: function (n) {
        //回调函数
        console.log(n);
        keyPersonPage = n;
        keyPersonPageList(n);
        // 当翻到下一页时 清除掉 全选按钮的 选中状态
        $('#keyPersonTableSelectAll').prop('checked', false);
      }
    });
  }
  var editKeyPersonArr = [];
  // 渲染 重点人员 列表
  function keyPersonPageList(n) {
    //hasExpired 是否过期 (true过期 false未过期)
    $('#keyPersonModal .tableBox tbody').html('');
    var page = n - 1;
    var size = 10;
    var searchName = $('#keyPersonModal .keyPersonSearchInput').val();
    // 获取重点人员列表 http://127.0.0.1:9092/keyPerson/getList?address=2&orgId=66&page=0&size=10
    $.ajax({
      url: '/keyPersonnel/getList?page=' +
        page +
        '&size=' +
        size +
        '&name=' +
        searchName,
      success: function (res) {
        console.log(res);
        if (res.status == 200) {
          keyPersonPageNum = res.data.totalPages;
          var data = res.data.content;
          editKeyPersonArr = data;
          console.log(editKeyPersonArr);
          var size = res.data.size;
          for (var i = 0; i < data.length; i++) {
            var name = data[i].name;

            // if (name.length > 35) {
            //   name = name.slice(0, 35) + ' . . .';
            // }
            // 35字
            $('#keyPersonModal .tableBox tbody').append(
              `<tr>
            <td><input type="checkbox" class="check" thisid="` +
              data[i].id +
              `"/></td>
            <td>` +
              ((n - 1) * size + i + 1) +
              `</td>
            <td>` +
              name +
              `</td>
            <td>` +
              data[i].gender +
              `</td>
            <td>` +
              data[i].age +
              `</td>
            <td>` +
              data[i].personnelType +
              `</td>
            <td>` +
              data[i].address +
              `</td>
                <td>` +
              data[i].telephone +
              `</td>
                <td>` +
              data[i].emergencyPeople +
              `</td>
                <td>` +
              data[i].emergencyPhone +
              `</td>
            <td>
              <span class="seeBtnStyle editKeyPerson-trigger" index="` +
              i +
              `" thisid="` +
              data[i].id +
              `">查看详情</span>
            </td>
          </tr>`
            );
          }
          keyPersonPageFunc(keyPersonPageNum, n);
        }
      }
    });
  }
  buildSearchFunc();
  // 按照重点人员地址模糊搜索
  function buildSearchFunc() {
    //模糊查询
    $('body').on('click', function () {
      $('#keyPersonModal .searchList').hide();
    });
    var fn = _.debounce(function () {
      $('#keyPersonModal .searchList').show();

      if ($('#keyPersonModal .searchList li')) {
        //键盘抬起后就判断页面中是否存在这个元素,存在就删除
        $('#keyPersonModal .searchList li').remove();
      }
      buildSearchContent = $('#keyPersonModal .keyPersonSearchInput').val();
      buildSearchContent = $.trim(buildSearchContent);
      console.log(buildSearchContent);
      if (buildSearchContent) {
        $.ajax({
          url: '/keyPersonnel/findLikeByName?name=' + buildSearchContent,
          type: 'GET',
          async: false,
          success: function (result) {
            console.log(result);
            var data = result.data;
            for (var i = 0; i < data.length; i++) {
              $('#keyPersonModal .searchList').append(
                '<li>' + data[i] + '</li>'
              );
            }
          }
        });
        $('#keyPersonModal .searchList').show();
      }
    }, 500);
    $('#keyPersonModal .keyPersonSearchInput').on('input', function (e) {
      fn();
    });
    //直接输入地址,点击列表查询
    $('#keyPersonModal .searchList').on('click', 'li', function () {
      $('#keyPersonModal .searchList').show();
      var liVal = $(this).text();
      liVal = $.trim(liVal);
      var searchVal = $('#keyPersonModal .keyPersonSearchInput').val(liVal);
      buildSearchContent = liVal;
      $('#keyPersonModal .searchList').html(''); //hide
      return false;
    });
  }
  // 点击搜索，查询
  $('#keyPersonSearchBtn').click(function () {
    $('#keyPersonTableSelectAll').prop('checked', false);
    keyPersonPageList(1);
  });

  //    重点人员添加
  // $('.addKeyPerson-pop').addClass('is-visible3');
  //重点人员管理添加 打开窗口
  $('.addKeyPerson-trigger').on('click', function (event) {
    event.preventDefault();
    $('.addKeyPerson-pop').addClass('is-visible3');
  });
  //重点人员管理添加 关闭窗口
  $('.addKeyPerson-pop').on('click', function (event) {
    if ($(event.target).is('.cd-popup-close') || $(event.target).is('.addKeyPerson-pop')) {

      event.preventDefault();
      $(this).removeClass('is-visible3');
      clearAddKeyPerson();
    }
  });

  function getObjectURL(file) {
    var url = null;
    if (window.createObjectURL != undefined) {
      // basic
      url = window.createObjectURL(file);
    } else if (window.URL != undefined) {
      // mozilla(firefox)
      url = window.URL.createObjectURL(file);
    } else if (window.webkitURL != undefined) {
      // webkit or chrome
      url = window.webkitURL.createObjectURL(file);
    }
    return url;
  }

  // 重点人员添加 点击上传图片到本地
  $('#addKeyPersonForm .touxiang').on('click', '.pic', function () {
    $(this)
      .parent()
      .find('.upload')
      .click(); //隐藏了input:file样式后，点击头像就可以本地上传
    $(this)
      .parent()
      .find('.upload')
      .on('change', function (e) {
        var objUrl = getObjectURL(this.files[0]); //获取图片的路径，该路径不是图片在本地的路径
        if (objUrl) {
          $(this)
            .parent()
            .find('.pic')
            .attr('src', objUrl);
          $(this)
            .parent()
            .find('.pic')
            .removeClass('opacity0');
        } else {
          $(this)
            .parent()
            .find('.pic')
            .addClass('opacity0');
        }
      });
  });
  // 重点人员信息 添加页面的 删除头像
  $('#addKeyPersonForm .delTouxiang').on('click', function () {
    $(this)
      .siblings('.pic')
      .attr('src', '');
    $('#addKeyPersonForm .pic').addClass('opacity0');
    $('#addKeyPersonForm .upload').val('');
  });


  // 重点人员添加
  addKeyPersonFormValidator();

  function addKeyPersonFormValidator() {
    $('#addKeyPersonForm')
      .bootstrapValidator({
        message: 'This value is not valid',
        feedbackIcons: {
          valid: 'glyphicon glyphicon-ok',
          invalid: 'glyphicon glyphicon-remove',
          validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
          name: {
            validators: {
              notEmpty: {
                message: '姓名不能为空'
              }
            }
          },
          personnelType: {
            validators: {
              notEmpty: {
                message: '人员类型不能为空'
              }
            }
          },
          age: {
            validators: {
              notEmpty: {
                message: '年龄不能为空'
              },
              regexp: {
                regexp: /^[0-9]*$/,
                message: '年龄只能包含数字'
              }
            }
          },
          gender: {
            validators: {
              notEmpty: {
                message: '性别不能为空'
              }
            }
          },
          address: {
            validators: {
              notEmpty: {
                message: '地址不能为空'
              }
            }
          },
          telephone: {
            validators: {
              notEmpty: {
                message: '联系电话不能为空'
              }
            }
          },
          emergencyPeople: {
            validators: {
              notEmpty: {
                message: '紧急人姓名不能为空'
              }
            }
          },
          emergencyPhone: {
            validators: {
              notEmpty: {
                message: '紧急人联系方式不能为空'
              }
            }
          },
          longitude: {
            validators: {
              notEmpty: {
                message: '经度不能为空'
              }
            }
          },
          latitude: {
            validators: {
              notEmpty: {
                message: '纬度不能为空'
              }
            }
          },
        }
      })
      .on('success.form.bv', function (e) {
        e.preventDefault();

        // var orgId = $("#addKeyPersonForm .bMInfoAddPageFormOrgList").val();
        var $form = $(e.target);
        var imgUrl = $('#addKeyPersonForm .touxiang img').attr('src');

        // var buildWorkRangeArrSub = [];
        // for (var i = 0; i < buildWorkRangeArr.length; i++) {
        //   var buildWorkRangeObjSub = {};
        //   buildWorkRangeObjSub.id = buildWorkRangeArr[i].id;
        //   console.log(i, buildWorkRangeArr[i].id)
        //   buildWorkRangeArrSub.push(buildWorkRangeObjSub);
        // }
        console.log(imgUrl);
        if (imgUrl) {
          var obj = new FormData($form[0]);

          // obj.append("workingRange", JSON.stringify(buildWorkRangeArrSub));
          console.log($form.serialize());
          // +'?workingRange='+buildWorkRangeArr
          $.ajax({
            url: '/keyPersonnel/save',
            type: 'POST',
            async: false,
            data: obj,
            contentType: false,
            processData: false,
            success: function (result) {
              console.log(result);
              if (result.status == 200) {
                $('.addKeyPerson-pop').removeClass('is-visible3');
                tipModalFunc('添加成功!');
                keyPersonPageList(keyPersonPage);
                // 添加成功后重新渲染

                // buildingPersonPageList(buildingPersonNumCurr, personSearchContent);
                //Modal验证销毁重构
                $('#addKeyPersonForm')
                  .data('bootstrapValidator')
                  .destroy();
                $('#addKeyPersonForm').data('bootstrapValidator', null);
                // // 清空数据
                $('#addKeyPersonForm')
                  .find('input')
                  .val('');
                $('#addKeyPersonForm .pic').attr('src', '');
                $('#addKeyPersonForm .pic').addClass('opacity0');
                addKeyPersonFormValidator();
              } else {
                console.log(result.message);
                $('#addKeyPersonForm')
                  .data('bootstrapValidator')
                  .destroy();
                $('#addKeyPersonForm').data('bootstrapValidator', null);

                $('#addKeyPersonForm .pic').attr('src', '');
                $('#addKeyPersonForm .pic').addClass('opacity0');
                addKeyPersonFormValidator();
              }
            },
            error: function () {
              $('#addKeyPersonForm')
                .data('bootstrapValidator')
                .destroy();
              $('#addKeyPersonForm').data('bootstrapValidator', null);

              $('#addKeyPersonForm .pic').attr('src', '');
              $('#addKeyPersonForm .pic').addClass('opacity0');
              addKeyPersonFormValidator();
            }
          });
        } else {
          var obj = $form.serialize();
          console.log(obj);
          $.ajax({
            url: '/keyPersonnel/save',
            type: 'POST',
            async: false,
            data: obj,
            success: function (result) {
              console.log(result);
              if (result.status == 200) {
                $('.addKeyPerson-pop').removeClass('is-visible3');
                tipModalFunc('添加成功!');
                keyPersonPageList(keyPersonPage);
                // 添加成功后重新渲染
                // buildingPersonPageList(buildingPersonNumCurr, personSearchContent);
                //Modal验证销毁重构
                $('#addKeyPersonForm')
                  .data('bootstrapValidator')
                  .destroy();
                $('#addKeyPersonForm').data('bootstrapValidator', null);

                $('#addKeyPersonForm .pic').attr('src', '');
                $('#addKeyPersonForm .pic').addClass('opacity0');
                // 清空数据
                $('#addKeyPersonForm')
                  .find('input')
                  .val('');
                addKeyPersonFormValidator();
              } else {
                console.log(result.message);
                $('#addKeyPersonForm')
                  .data('bootstrapValidator')
                  .destroy();
                $('#addKeyPersonForm').data('bootstrapValidator', null);

                $('#addKeyPersonForm .pic').attr('src', '');
                $('#addKeyPersonForm .pic').addClass('opacity0');
                addKeyPersonFormValidator();
              }
            },
            error: function () {
              $('#addKeyPersonForm')
                .data('bootstrapValidator')
                .destroy();
              $('#addKeyPersonForm').data('bootstrapValidator', null);

              $('#addKeyPersonForm .pic').attr('src', '');
              $('#addKeyPersonForm .pic').addClass('opacity0');
              addKeyPersonFormValidator();
            }
          });
        }
      });
  }

  // 删除楼宇详情的图片
  $('#editKeyPersonForm .delTouxiang').on('click', function () {
    if (delTouxiangFlag) {
      $(this)
        .siblings('.pic')
        .attr('src', '');
      $('#editKeyPersonForm .pic').addClass('opacity0');
      $('#editKeyPersonForm .upload').val('');
      $('#editKeyPersonForm .oldPhoto').val('');
    }
  });

  // 清空重点人员添加数据
  function clearAddKeyPerson() {
    //Modal验证销毁重构
    $('#addKeyPersonForm')
      .data('bootstrapValidator')
      .destroy();
    $('#addKeyPersonForm').data('bootstrapValidator', null);
    // // 清空数据
    $('#addKeyPersonForm')
      .find('input')
      .val('');
    $('#addKeyPersonForm .pic').attr('src', '');
    $('#addKeyPersonForm .pic').addClass('opacity0');
    addKeyPersonFormValidator();
  }

  var keyPersonIndex = '';
  //重点人员管理修改 打开窗口
  $('#keyPersonModal').on('click', '.editKeyPerson-trigger', function (event) {
    event.preventDefault();
    $('.editKeyPerson-pop').addClass('is-visible3');
    var index = $(this).attr('index');
    keyPersonIndex = index;
    var arr = editKeyPersonArr[index];
    console.log(arr);

    $('#editKeyPersonForm .editKeyPersonImg img').attr('src', arr.headPortraitUrl);
    $('#editKeyPersonForm .name').val(arr.name);
    $('#editKeyPersonForm .personnelType').val(arr.personnelType);
    $('#editKeyPersonForm .age').val(arr.age);
    $('#editKeyPersonForm .gender').val(arr.gender);
    $('#editKeyPersonForm .address').val(arr.address);
    $('#editKeyPersonForm .telephone').val(arr.telephone);
    $('#editKeyPersonForm .emergencyPeople').val(arr.emergencyPeople);
    $('#editKeyPersonForm .emergencyPhone').val(arr.emergencyPhone);
    $('#editKeyPersonForm .longitude').val(arr.longitude);
    $('#editKeyPersonForm .latitude').val(arr.latitude);
    if (arr.headPortraitUrl) {
      $('#editKeyPersonForm .touxiang .pic').removeClass('opacity0');
      $('#editKeyPersonForm .oldPhoto').val(arr.headPortraitUrl);
    } else {
      $('#editKeyPersonForm .touxiang .pic').addClass('opacity0');
    }
    // 点击查看详情时，只查看不修改
    $('#editKeyPersonForm input').attr('disabled', 'disabled');
    $('#editKeyPersonForm select').attr('disabled', 'disabled');
    $('#editKeyPersonForm select').addClass('disabledStyle');
    $('#editKeyPersonForm input').addClass('disabledStyle');
    delTouxiangFlag = false;
    $('#editKeyPersonForm .allowEdit').show();
    $('#editKeyPersonBtn').hide();
  });

  var delTouxiangFlag = false;
  // 点击修改时,可以修改编辑
  $('#editKeyPersonForm .allowEdit').on('click', function () {
    delTouxiangFlag = true;
    $('#editKeyPersonForm .allowEdit').hide();
    $('#editKeyPersonBtn').show();
    $('#editKeyPersonForm input').removeAttr('disabled');
    $('#editKeyPersonForm select').removeAttr('disabled');
    $('#editKeyPersonForm select').removeClass('disabledStyle');
    $('#editKeyPersonForm input').removeClass('disabledStyle');
  });
  // 修改重点人员图片
  $('#editKeyPersonForm .editKeyPersonImg').on('click', '.pic', function () {
    console.log(this);
    $(this)
      .parent()
      .find('.upload')
      .click(); //隐藏了input:file样式后，点击头像就可以本地上传
    $(this)
      .parent()
      .find('.upload')
      .on('change', function (e) {
        console.log(this.files[0]);
        var objUrl = getObjectURL(this.files[0]); //获取图片的路径，该路径不是图片在本地的路径
        console.log(objUrl);
        picThat = this;
        console.log(this);
        if (objUrl) {
          $(this)
            .parent()
            .find('.pic')
            .attr('src', objUrl);
          $(this)
            .parent()
            .find('.pic')
            .removeClass('opacity0');
        } else {
          $(this)
            .parent()
            .find('.pic')
            .addClass('opacity0');
        }
      });
  });
  // 修改重点人员
  editKeyPersonFormValidator();

  function editKeyPersonFormValidator() {
    $('#editKeyPersonForm')
      .bootstrapValidator({
        message: 'This value is not valid',
        feedbackIcons: {
          valid: 'glyphicon glyphicon-ok',
          invalid: 'glyphicon glyphicon-remove',
          validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
          name: {
            validators: {
              notEmpty: {
                message: '姓名不能为空'
              }
            }
          },
          personnelType: {
            validators: {
              notEmpty: {
                message: '人员类型不能为空'
              }
            }
          },
          age: {
            validators: {
              notEmpty: {
                message: '年龄不能为空'
              },
              regexp: {
                regexp: /^[0-9]*$/,
                message: '年龄只能包含数字'
              }
            }
          },
          gender: {
            validators: {
              notEmpty: {
                message: '性别不能为空'
              }
            }
          },
          address: {
            validators: {
              notEmpty: {
                message: '地址不能为空'
              }
            }
          },
          telephone: {
            validators: {
              notEmpty: {
                message: '联系电话不能为空'
              }
            }
          },
          emergencyPeople: {
            validators: {
              notEmpty: {
                message: '紧急人姓名不能为空'
              }
            }
          },
          emergencyPhone: {
            validators: {
              notEmpty: {
                message: '紧急人联系方式不能为空'
              }
            }
          },
          longitude: {
            validators: {
              notEmpty: {
                message: '经度不能为空'
              }
            }
          },
          latitude: {
            validators: {
              notEmpty: {
                message: '纬度不能为空'
              }
            }
          },
        }
      })
      .on('success.form.bv', function (e) {
        e.preventDefault();
        var $form = $(e.target);
        var imgUrl = $('#editKeyPersonForm .touxiang img').attr('src');
        console.log(imgUrl);

        var id = editKeyPersonArr[keyPersonIndex].id;
        var oldPhoto = $('#editKeyPersonForm .oldPhoto').val();
        var newPhoto = $('#editKeyPersonForm .touxiang img').attr('src');
        console.log(oldPhoto, newPhoto, oldPhoto == newPhoto);

        if (oldPhoto != newPhoto && newPhoto != '') {
          var obj = new FormData($form[0]);
          // obj.id = id;
          console.log($form.serialize());
          $.ajax({
            url: '/keyPersonnel/save?id=' + id,
            type: 'POST',
            async: false,
            data: obj,
            contentType: false,
            processData: false,
            success: function (result) {
              console.log(result);
              if (result.status == 200) {
                $('.editKeyPerson-pop').removeClass('is-visible3');
                tipModalFunc('修改成功!');
                keyPersonPageList(keyPersonPage);
                //Modal验证销毁重构
                $('#editKeyPersonForm')
                  .data('bootstrapValidator')
                  .destroy();
                $('#editKeyPersonForm').data('bootstrapValidator', null);
                // // 清空数据
                $('#editKeyPersonForm')
                  .find('input')
                  .val('');
                $('#editKeyPersonForm .pic').attr('src', '');
                editKeyPersonFormValidator();
              } else {
                console.log(result.message);
                $('#editKeyPersonForm')
                  .data('bootstrapValidator')
                  .destroy();
                $('#editKeyPersonForm').data('bootstrapValidator', null);

                $('#editKeyPersonForm .pic').attr('src', '');
                editKeyPersonFormValidator();
              }
            },
            error: function () {
              $('#editKeyPersonForm')
                .data('bootstrapValidator')
                .destroy();
              $('#editKeyPersonForm').data('bootstrapValidator', null);

              $('#editKeyPersonForm .pic').attr('src', '');
              editKeyPersonFormValidator();
            }
          });
        } else {
          var obj = $form.serialize();
          obj = obj + '&headPortraitUrl=' + oldPhoto + '&id=' + id;

          console.log(obj);
          $.ajax({
            url: '/keyPersonnel/save',
            type: 'POST',
            async: false,
            data: obj,
            success: function (result) {
              console.log(result);
              if (result.status == 200) {
                $('.editKeyPerson-pop').removeClass('is-visible3');
                tipModalFunc('修改成功!');
                keyPersonPageList(keyPersonPage);
                //Modal验证销毁重构
                $('#editKeyPersonForm')
                  .data('bootstrapValidator')
                  .destroy();
                $('#editKeyPersonForm').data('bootstrapValidator', null);

                $('#editKeyPersonForm .pic').attr('src', '');
                // 清空数据
                $('#editKeyPersonForm')
                  .find('input')
                  .val('');
                editKeyPersonFormValidator();
              } else {
                console.log(result.message);
                $('#editKeyPersonForm')
                  .data('bootstrapValidator')
                  .destroy();
                $('#editKeyPersonForm').data('bootstrapValidator', null);

                $('#editKeyPersonForm .pic').attr('src', '');
                editKeyPersonFormValidator();
              }
            },
            error: function () {
              $('#editKeyPersonForm')
                .data('bootstrapValidator')
                .destroy();
              $('#editKeyPersonForm').data('bootstrapValidator', null);

              $('#editKeyPersonForm .pic').attr('src', '');
              editKeyPersonFormValidator();
            }
          });
        }
      });
  }
  //重点人员管理修改 关闭窗口
  $('.editKeyPerson-pop').on('click', function (event) {
    if ($(event.target).is('.cd-popup-close') || $(event.target).is('.editKeyPerson-pop')) {
      event.preventDefault();
      $(this).removeClass('is-visible3');
      clearEditKeyPerson();
    }
  });

  // 清空重点人员编辑数据
  function clearEditKeyPerson() {
    $('#keyPersonContentEdit').val('');
    $('#editKeyPersonForm .oldPhoto').val('');
  }
});